package com.dong.datachangecontrol.demo.service;

import com.dong.datachangecontrol.demo.annotation.PersonSelect;
import com.dong.datachangecontrol.demo.dao.PersonDao;
import com.dong.datachangecontrol.demo.entity.Person;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class PersonServiceImpl implements  PersonService {
   @Autowired
    private PersonDao personDao;
    @Override
   // @Cacheable(value = "person",key = "methodName")
    @PersonSelect("sdfsdfsdfsfsd")
    public List<Person> getPersonList() {
        return personDao.getPersonList();
    }

    @Override
    public Person updatePerson(Person person) {
        return personDao.updatePerson(person);
    }

    @Override
    public Person deleteById(Integer id) {
        return personDao.deleteById(id);
    }

    @Override
    public Person addPerson(Person person) {
        return personDao.addPerson(person);
    }

    @Override
    public Person getById(Integer id) {
        return personDao.getById(id);
    }
}
